﻿@{
    ViewBag.Title = "AuthCheck";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section head{
    <link rel="stylesheet" href="/content/css/pages/page_reg.css" />
}
<div class="breadcrumbs margin-bottom-40">
    <div class="container">
        <div class="row">
            <div id="fuelux-wizard" class="row-fluid" data-target="#step-container">
                <ul class="wizard-steps">
                    <li data-target="#step1" class="active"><span class="step">1</span> <span class="title">
                        新用户开通注册</span> </li>
                    <li data-target="#step2" class="active"><span class="step">2</span> <span class="title">注册开通第三方资金托管账号</span>
                    </li>
                    <li data-target="#step3" class="active"><span class="step">3</span> <span class="title">安全认证</span>
                    </li>
                    <li data-target="#step4"><span class="step">4</span> <span class="title">注册完成</span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="container">
    <div class="row-fluid">
        <div class="span6 offset3">
            <div class="tab-v1">
                <div class="tab-content" style="padding-top: 0;">
                    <div class="reg-page tab-pane active" style="padding: 5px 10px;" >
                    @{
                        RooHui.Infrastructure.Entities.Entity.Member member = ViewBag.Member; 
                    }
                        <form id="regform" action="" method="post">
                        <input type="hidden" name="token" />
                        <div class="control-group">
                            <label>
                                注册账号：</label>
                            <input type="text" class="form-control input-xlarge" disabled="disabled" 
                                value="@member.UserName" id="txtusername" name="username" />                     
                        </div>
                        <div class="control-group">
                            <label>
                                第三方资金账号：</label>
                            <input type="text" class="form-control input-xlarge" disabled="disabled" 
                                value="xxxxxxx" id="txtpaymentaccount" name="paymentaccount" /> 
                            <span class="label label-success">已认证</span>                       
                        </div>
                        <div class="alert alert-success">
                            <h3>请进入注册邮箱激活您的账号！</h3>
                            <p>您已成功完成了第三方资金账户托管。现请完成您的账号激活，请进入您注册时使用的邮件点击链接激活您的账号。</p>
                            <p>
                                没收到邮件？ <input type="button" class="btn btn-info margin-bottom-10" 
                                    onclick="resendemail(this)" value="重发激活邮件" />
                            </p>
                        </div>
                        <hr />
                        <div class="row-fluid">
                            <div class="span9">
                                <label class="checkbox">
                                    <input type="checkbox" checked="checked" />
                                    我已阅读并同意 <a href="javascript:;" class="color-green">融汇贷投资人协议</a> | <a href="/account/login"
                                        class="color-green">返回登录</a>
                                </label>
                            </div>
                        </div>
                        </form>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script type="text/javascript" src="/content/scripts/plug.js"></script>
    <script type="text/javascript">
        var username = '@RooHui.Tool.EncodeByBase64.Encode(member.UserName)';
        var email_interval = null;
        var email_second = 60;
        function resendemail(sender) {
            $.ajax({
                url: '/account/resendemail',
                data: {
                    u: username
                },
                beforeSend: function () {
                    $(sender).attr('disabled', 'disabled');
                },
                success: function (result) {
                    if (result == 1) {
                        email_interval = window.setInterval(function () {
                            if (email_second > 0) {
                                email_second = parseInt(email_second, 10) - 1;
                                $(sender).val(email_second + ' 秒后重新发送');
                            }
                            else {
                                window.clearInterval(email_interval);
                                $(sender).removeAttr('disabled').val('重发认证邮件');
                            }
                        }, 1000);
                    }
                    else {
                        $(sender).attr('class', 'btn btn-danger margin-bottom-10').val('用户名异常');
                        $.get('/home/log', { msg: '@member.UserName -> ' + username + ' (resendemail fail!)' });
                    }
                }
            });
        }
    </script>
}
